﻿using IM.Easy.Core.Configuration;

namespace IM.Easy.Core.Options
{

    [SectionName("JWTSettings")]
    public class JwtOptions : IConfigurable
    {

        /// <summary>
        /// 是否验证签发密钥
        /// </summary>
        public bool ValidateIssuerSigningKey { get; set; } = true;

        /// <summary>
        /// 签发密钥
        /// </summary>
        public string IssuerSigningKey { get; set; } = "AF7F07F1-BCFA-4E94-A80A-5EDDE480EC2B";

        /// <summary>
        /// 是否验证签发方
        /// </summary>
        public bool ValidateIssuer { get; set; } = true;

        /// <summary>
        /// 签发方
        /// </summary>
        public string ValidIssuer { get; set; }

        /// <summary>
        /// 是否验证受众
        /// </summary>
        public bool ValidateAudience { get; set; } = true;

        /// <summary>
        /// 受众
        /// </summary>
        public string ValidAudience { get; set; }

        /// <summary>
        /// 是否验证生命周期
        /// </summary>
        public bool ValidateLifetime { get; set; } = true;

        /// <summary>
        /// 令牌过期时间（分钟）
        /// </summary>
        public long ExpiredTime { get; set; } = 20;

        /// <summary>
        /// 时钟偏差容忍值（秒）
        /// </summary>
        public long ClockSkew { get; set; } = 5;

        /// <summary>
        /// 加密算法
        /// </summary>
        public string Algorithm { get; set; } = "HS256";
    }

}
